<template>
  <div>
    <Chart :cdata="cdata"/>
  </div>
</template>

<script>
import Chart from './chart.vue';
import {getYearStageTotalCO2, queryAllProcessEmissionOrigin} from "@/api/carbon-manage/data";

export default {
  data() {
    return {
      cdata: {
        indicatorData: [
          {name: "燃料燃烧", max: 300},
          {name: "工业生产", max: 250},
          {name: "电力热力", max: 300},
          {name: "固碳产品", max: 5},
        ],
        dataBJ: [
          [234, 185, 230, 4.09],
        ]
      }
    }
  },
  mounted() {
    this.loadData();
  },
  methods: {
    loadData() {
      getYearStageTotalCO2(2024).then(res => {
        let data = res.data
        let max = Math.max(data["燃料燃烧"], data["工业生产"], data["电力热力"], data["固碳产品"]);
        this.cdata = {
          indicatorData: [
            {name: "燃料燃烧", max: max},
            {name: "工业生产", max: max},
            {name: "电力热力", max: max},
            {name: "固碳产品", max: max},
          ],
          dataBJ: [
            [data["燃料燃烧"], data["工业生产"], data["电力热力"], data["固碳产品"]],
          ]
        };
      });
    },
  },
  components: {
    Chart,
  }
}
</script>
